<!DOCTYPE html>
<html>
<meta charset="utf-8">
<body>
<?php include 'submitdatabaseinfo.php';?>
<?php
$primarykey = $_GET['primarykey'];
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
mysqli_set_charset($conn, "utf8");
// Check connection
if (!$conn) {
  die("Database connection failed: " . mysqli_connect_error());
}
$sql = "SELECT title, story FROM stories WHERE primarykey = '".$primarykey."'";
$result = mysqli_query($conn,$sql);
$rows = mysqli_num_rows($result);

while($row = mysqli_fetch_array($result)){
  $txt = wordwrap($row["story"],70);	
  echo "<h2>" . $row["title"] . "</h2><br><br><pre>" . $txt . "</pre>";
}

mysqli_close($conn);
exit;
?>
</body>
</html>
